package source.model;

import source.model.type.GameObjectType;

/**
 * This interface is meant for any object is the game that need be represented or can
 * be found inside of a GameData collection.
 * @author Sean Larson
 *
 */
public interface GameObject {

	/**
	 * The isValid operation is meant to allow the dataHandler to quickly determine
	 * if something has happened to the object that would mean that the object should
	 * be removed from it's respective gameData collection.
	 * It's possible that the gameData object could check this when storing objects
	 * or whenever data is returned (i.e., some work has been done and the object
	 * is returned to the dataHandler).
	 * @return true if the object is still valid; false otherwise
	 */
	public boolean isValid();
	
	/**
	 * Returns the ObjectID for this object.
	 * @return ObjectID associated with this GameObject.
	 */
	public ObjectID objectID();
	
	/**
	 * The enumeration value of this object.
	 * @return GameObjectType enumeration value associated with this GameObject.
	 */
	public GameObjectType objectType();
	
	/**
	 * This method is meant to inform the dataHandler if the object is of a type that
	 * would be owned by the player in the game (i.e., Unit vs. Terrain).
	 * @return true if the object is a player owned object, false otherwise.
	 */
	public boolean isPlayerOwned();
	
	/**
	 * This method is used to mark the object as having been forcibly moved (i.e.,
	 * Unit teleported using Area Effect) and that it's possition needs to be changed.
	 * @param x new x-coordinate
	 * @param y new y-coordinate
	 * @return true if object allowed the forced change, false otherwise
	 */
	public boolean changePosition( int x, int y );
	
	/**
	 * Queries the object to find out if the changePositionFlag is set, meaning
	 * the object's position in pMap must be updated
	 * @return true if flag set; false otherwise
	 */
	public boolean changePositionFlag();
	
	public Position newPosition();
	
	/**
	 * Once the DataHandler resets the position of the object, it calls this method to
	 * let the object know that it is now no longer in a "Forced Position Change" 
	 * state
	 * @return true if the object reset it's flag, false otherwise
	 */
	public boolean resetPositionChangedFlag();
	
	/**
	 * Returns a Hashtable that represents all revelavent viewing data for the
	 * GameObject.  For example, a unit would populate the hasthable with it's stats,
	 * while a terrain might give its movemnt cost.
	 * 
	 * @return A hashtable mapping stat names to data.
	 */
	public java.util.Hashtable<String, String> getViewData();
	
	public void invalidate();
}
